﻿using System;
using System.Collections.Generic;
using System.Linq;
using Xinkui.WebModel.BasicControl;
using Xinkui.WebModel.Model;

public partial class UserControl_ShowRoom_UC_Right_Company : ShowRoomControl {

    public int FirstCount { get; set; }

    public int SecondCount { get; set; }

    protected void Page_Load(object sender, EventArgs e) {

        List<PropertyItem> properties = new List<PropertyItem>(10);

        if (!string.IsNullOrEmpty(this.CompanyView.BussinessTypeName))
            properties.Add(new PropertyItem {
                Title = "Bussiness Type",
                Value = this.CompanyView.BussinessTypeName
            });

        if (!string.IsNullOrEmpty(this.CompanyView.CompanyEntity.MainProduct))
            properties.Add(new PropertyItem {
                Title = "Main Products",
                Value = this.CompanyView.CompanyEntity.MainProduct
            });


        properties.Add(new PropertyItem {
            Title = "OE Experience",
            Value = this.CompanyView.CompanyEntity.IsOE == 1 ? "Yes" : "No"
        });

        properties.Add(new PropertyItem {
            Title = "Export Experience",
            Value = this.CompanyView.CompanyEntity.IsExport == 1 ? "Yes" : "No"
        });

        if (!string.IsNullOrEmpty(this.CompanyView.NumberOfEmpoyeesName))
            properties.Add(new PropertyItem {
                Title = "Number of Employees",
                Value = this.CompanyView.NumberOfEmpoyeesName
            });

        if (!string.IsNullOrEmpty(this.CompanyView.NumberofRDEmployeesName))
            properties.Add(new PropertyItem {
                Title = "Number of RDEmployees",
                Value = this.CompanyView.NumberofRDEmployeesName
            });
        if (!string.IsNullOrEmpty(this.CompanyView.CompanyEntity.YearEstabished))
            properties.Add(new PropertyItem {
                Title = "Year of Established",
                Value = this.CompanyView.CompanyEntity.YearEstabished
            });
        if (!string.IsNullOrEmpty(this.CompanyView.TotalAnnualSalesName))
            properties.Add(new PropertyItem {
                Title = "Annual Turnover",
                Value = this.CompanyView.TotalAnnualSalesName
            });
        if (!string.IsNullOrEmpty(this.CompanyView.RegisterCapitalName))
            properties.Add(new PropertyItem {
                Title = "Register Capital",
                Value = this.CompanyView.RegisterCapitalName
            });

        this.rptBussinessInfo.DataSource = properties;
        this.rptBussinessInfo.DataBind();

        FirstCount = this.CompanyView.Equipments == null ? 0 : this.CompanyView.Equipments.Count;
        SecondCount = this.CompanyView.Certificates == null ? 0 : this.CompanyView.Certificates.Count;
        if (FirstCount > 0) {
            this.rptDeviceDataSource.DataSource = this.CompanyView.Equipments;
            this.rptDeviceDataSource.DataBind();
        }

        if (SecondCount > 0) {
            this.rptCeritificateDataSource.DataSource = this.CompanyView.Certificates;
            this.rptCeritificateDataSource.DataBind();
        }

    }



}